<?php
namespace My\Controller;

use Utuo\BackgroundController;

class ProductSlideController extends BackgroundController {
	
	public function _initialize() {
		$this->setControllerTitle("轮播图管理");
		$this->setActionTitle(array(
				'index' => '轮播图设置',
		));
	}
	
	// 轮播图设置
	public function indexAction() {
		$m = M("Product");
		$product = $m->where("id=%d", $this->aid)->find();
		$product["slide_images"] = (array)unserialize($product["slide_images"]);
		$this->assign("product", $product);
		$this->display();
	}
	
	// 提交轮播图设置
	public function indexPostAction() {
		$d = D('Product');
		$d->create() and $d->id = $this->aid and false !== $d->save() and $this->ajaxSuccess("轮播图保存成功");
		$this->ajaxError($d->getLastSql());
	}
	
}